
#日程中 添加日程页面类

from selenium.webdriver.common.by import By
from page.base_page import BasePage

class NewschedulePage(BasePage):
    url = '/crm/index.php?m=event&a=add'

    #定位器
    motif_locator = (By.ID, 'subject')  # 新建日程，主题

    didian_locator = (By.ID, 'venue')  # 点击地点框
    youjian_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tbody/tr[4]/td[4]/input[1]')  # 通知邮件 是
    noyoujian_locator = (By.XPATH,'/html/body/div[5]/div[2]/div/form/table/tbody/tr[4]/td[4]/input[2]') # 通知邮件 否
    miaoshu_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tbody/tr[6]/td[2]/textarea')  # 描述
    baocun_locator = (By.XPATH, '/html/body/div[5]/div[2]/div/form/table/tfoot/tr/td[2]/input[1]')  # 保存按钮
    tianjiaricheng = (By.XPATH,'/html/body/div[5]/div[2]')

#获取当前页面地址
    def get_current_url(self):
        return self.driver.current_url

    #往主题框中输入内容
    def input_motif(self,motif):
        self.driver.find_element(*self.motif_locator).send_keys(motif)

    #点击地点框输入东西
    def input_didian(self,didian):
        self.driver.find_element(*self.didian_locator).send_keys(didian)

    #点击通知邮件  是
    def click_youjian(self):
        self.driver.find_element(*self.youjian_locator).click()

    #点击通知邮件 否
    def click_noyoujian(self):
        self.driver.find_element(*self.noyoujian_locator).click()
    #描述框输入内容
    def input_miaoshu(self,miaoshu):
        self.driver.find_element(*self.miaoshu_locator).send_keys(miaoshu)

    #点击保存按钮
    def click_baocun(self):
        self.driver.find_element(*self.baocun_locator).click()

    #添加成功定位器
    def text_tianjiaricheng(self):
        return self.driver.find_element(*self.tianjiaricheng).get_attribute("class")